
#include <BStyle>
#include <BHBoxLayout>

#include "OutputWidget.h"

OutputWidget::OutputWidget(BWidget* parent) : BTextEdit(parent)
{
	BHBoxLayout* topLayout = new BHBoxLayout(this, Part_Top);
	{
		_clearButton = new BButton("clear");
		_clearButton->setForm(Form_IconAlone);
		topLayout->addWidget(_clearButton);
		topLayout->addSpring();
	}
	connect(_clearButton, Signal_Clicked, &OutputWidget::slotClearButtonClicked);
}
OutputWidget::~OutputWidget()
{

}

void OutputWidget::slotClearButtonClicked()
{
	this->setText(BString());
}

void OutputWidget::styleEvent(const BEvent& event)
{
	BTextEdit::styleEvent(event);
	const BStyle* style = event.value();
	_clearButton->setIcon(style->icon("clear"));
}

